package com.fizzkai.p2p.mgrsite.controller;

import com.fizzkai.p2p.bussness.domain.PlatformBankInfo;
import com.fizzkai.p2p.bussness.query.PlatformBankInfoQuery;
import com.fizzkai.p2p.bussness.service.IPlatformBankInfoService;
import com.fizzkai.p2p.core.util.AjaxResult;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PlatformBankInfoController {

    @Autowired
    private IPlatformBankInfoService bankInfoService;

    /**
     * 后台管理 银行卡页面
     * @param qo
     * @param model
     * @return
     */
    @RequestMapping("/companyBank_list")
    public String companyBank_list(@ModelAttribute("qo") PlatformBankInfoQuery qo, Model model){
        PageInfo<PlatformBankInfo> pageInfo = bankInfoService.query(qo);
        model.addAttribute("pageInfo", pageInfo);
        return "platformbankinfo/list";
    }

    /**
     * 保存 或 更新 银行卡
     * @return
     */
    @RequestMapping("/companyBank_update")
    @ResponseBody
    public Object companyBank_update(PlatformBankInfo bankInfo){
        bankInfoService.saveOrUpdate(bankInfo);
        return new AjaxResult("操作成功");
    }
    
}
